﻿using System;
using System.Security.Cryptography;
using System.Text;

namespace Zadani09.util
{
    public class Util
    {

        public static string generateRandomID(){

            string temp = DateTime.Now.ToFileTime().ToString().Substring(6,8);
      
            return temp;
        }

        public static string Md5(string vstup)
        {
            byte[] pass = Encoding.UTF8.GetBytes(vstup);
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] hashed = md5.ComputeHash(pass);

            StringBuilder s = new StringBuilder();

            foreach (byte item in hashed)
            {
                s.Append(item.ToString("x2").ToLower());
            }

            string vystup = s.ToString();
            return vystup;
        } 

    }
}
